#include<linux/list.h>
#include "common.h"
#include "memcg.h"

int memcg_dying_scan(void)
{
    int offline  = 1;
    struct memcg_info info;

    INIT_LIST_HEAD(&info.head);
    memcg_scan(&info, NULL, offline);
    memcg_dump(&info);
    memcg_free_all(&info); 
    
    return 0; 
}

int memcg_scan_one(void)
{
    char *cgname = "/sys/fs/cgroup/memory/agent";
    struct mem_cgroup *memcg;
    struct memcg_info info;

    INIT_LIST_HEAD(&info.head);
    memcg = memcg_get_by_name(cgname);
    memcg_scan(&info, memcg, 0);
    memcg_dump(&info);
    memcg_free_all(&info);
    return 0; 
}
